// 默认激活当前标签样式
a[0].classList.add("active")
// 轮播图插件
var swiper = new Swiper(".mySwiper", {
    cssMode: true,
    loop:true,
    autoplay:true,
    navigation: {
      nextEl: ".swiper-button-next",
      prevEl: ".swiper-button-prev",
    },
    pagination: {
      el: ".swiper-pagination",
      clickable :true,
    },
    mousewheel: true,
    keyboard: true,
  });
  
// 获取要操作轮播图的元素
let banner = document.querySelector("banner")


// 海量api
// 鼠标悬浮显示
let apiContents =document.querySelectorAll(".api-content li")
let imgs = document.querySelectorAll(".api-content li img")

apiContents.forEach((item,index) => {
    // item是每一项
    item.addEventListener("mouseover",() => {
        // 给当前元素添加类名
        item.classList.add("api-content_active")
        // 给当前img元素替换图片
        imgs[index].src=`./images/api0${index +1}-c.svg`
    })
    item.addEventListener("mouseout",() => {
        // 给当前元素删除类名
        item.classList.remove("api-content_active")
        // 给当前img元素替换图片
        imgs[index].src=`./images/api0${index +1}.svg`
    })
})


// 显示覆盖
let change = document.querySelectorAll(".business .business-list")
console.log(change)
let index = 0;
setInterval(() => {
    // 每次让前一个change隐藏
    change[index].classList.remove("show")
    index++
    if (index >= change.length) {
        index = 0
    }
    // 每2s后让下一个显示
    change[index].classList.add("show")
}, 2000)//每隔2s执行一次